/**
 * Author : wang885298.
 * Date   : 2018/9/13.
 * File   : index.
 */
import post from '../post/post-proxy'
export default {
  /**
   * 登录
   * @param loginName
   * @param pwd
   */
  login: (loginName, pwd) => {
    return post('oauth', 'ehome.inner.ac.login.get', {loginName, pwd})
  },
  newLogin ({ guanLiYmm, guanLiYzh, liulanQmc }) {
    var params = {guanLiYmm, guanLiYzh}
    if (liulanQmc) {
      params['liulanQmc'] = liulanQmc
    }
    return post('login', '/tianwang/shuju/guanliyxx/denglu/get', params)
  },
  /**
   * ehome.metadata.province.list.get 获取中国省/直辖市/特区/州元数据列表
   * @param cn
   */
  provinceListGet: ({cn}) => {
    let params = {}
    if (cn) {
      params.cn = cn
    }
    return post('inner', 'ehome.metadata.province.list.get', params)
  },
  /**
   * ehome.metadata.city.list.get 获取城市元数据列表
   * @param provinceId
   * @param cn
   */
  cityListGet: ({provinceId, cn}) => {
    let params = {
      'provinceId': provinceId
    }
    if (cn) {
      params.cn = cn
    }
    return post('inner', 'ehome.metadata.city.list.get', params)
  },
  /**
   * ehome.metadata.district.list.get 获取区县元数据列表
   * @param cityId
   * @param cn
   */
  districtListGet: ({cityId, cn}) => {
    let params = {
      'cityId': cityId
    }
    if (cn) {
      params.cn = cn
    }
    return post('inner', 'ehome.metadata.district.list.get', params)
  },
  /**
   * ehome.metadata.street.list.get 获取县街道元数据列表
   * @param districtId
   * @param cn
   */
  streetListGet: ({districtId, cn}) => {
    let params = {
      'districtId': districtId
    }
    if (cn) {
      params.cn = cn
    }
    return post('inner', 'ehome.metadata.street.list.get', params)
  },
  /**
   * ehome.metadata.road.list.get 获取道路列表
   * @param _pageSize
   * @param _page
   * @param cn
   */
  roadListGet: ({_pageSize, _page, cn}) => {
    let params = {
      '_pageSize': _pageSize,
      '_page': _page
    }
    if (cn) {
      params.cn = cn
    }
    return post('inner', 'ehome.metadata.road.list.get', params)
  },
  /**
   * ehome.metadata.road.add 添加道路
   * @param streetId
   * @param cn
   */
  roadAdd: ({streetId, cn}) => {
    let params = {
      'streetId': streetId,
      'cn': cn
    }
    return post('inner', 'ehome.metadata.road.add', params)
  },
  /**
   * ehome.metadata.road.update 修改道路
   * @param streetId
   * @param cn
   * @param roadId
   */
  roadUpdate: ({streetId, cn, roadId}) => {
    let params = {
      'streetId': streetId,
      'cn': cn,
      'roadId': roadId
    }
    return post('inner', 'ehome.metadata.road.update', params)
  },
  /**
   * ehome.metadata.road.delete 删除道路
   * @param roadId
   */
  roadDel: ({roadId}) => {
    let params = {
      'roadId': roadId
    }
    return post('inner', 'ehome.metadata.road.delete', params)
  },
  /**
   * ehome.metadata.road.batch.delete 批量删除道路
   * @param roadIds
   */
  roadBatchDel: ({roadIds}) => {
    let params = {
      'roadIds': roadIds
    }
    return post('inner', 'ehome.metadata.road.batch.delete', params)
  },
  /**
   * ehome.metadata.batch.check.road 批量校验道路是否符合格式
   */
  roadBatchCheck: (param) => {
    // let params = {}
    return post('inner', 'ehome.metadata.batch.check.road', param)
  },
  /**
   * ehome.metadata.batch.road.add 批量添加道路
   * @param correctData
   */
  roadBatchAdd: ({correctData}) => {
    let params = {
      'correctData': correctData
    }
    return post('inner', 'ehome.metadata.batch.road.add', params)
  },
  /**
   * 获取荔波县街道列表
   * @author wang885298
   * @createDate 2019-04-03
   * @param      {String}   options.cn 街道列表
   */
  getLiboStreetList ({ cn }) {
    var params = {}
    if (cn) {
      params['cn'] = cn
    }
    return post('oauth', 'ehome.metadata.libo.street.list.get', params)
  },
  /**
   * 关联楼栋列表
   * @author wang885298
   * @createDate 2019-04-04
   * @param {String}
   */
  louDongGLListGet ({ guanLianMdzj, ldxxMc, page, pageSize, xzjdId }) {
    let params = {guanLianMdzj, ldxxMc, page, pageSize, xzjdId}
    if (ldxxMc) {
      params['ldxxMc'] = ldxxMc
    }
    if (xzjdId) {
      params['xzjdId'] = xzjdId
    }
    return post('login', '/tianwang/zhzxrhpt/loudong/gl/list', params)
  },
  /**
   * 3D打点关联/解除关联
   * @author wang885298
   * @createDate 2019-04-04
   * @param {String}
   */
  louDong3dGL ({ glzt, guanLianMdzj, ldxxZj }) {
    let params = {glzt, guanLianMdzj, ldxxZj}
    return post('login', '/tianwang/zhzxrhpt/loudong/3d/gl', params)
  },
  /**
   * 获取楼栋列表
   * @param ldxxMc
   * @param page
   * @param pageSize
   * @param xzjdId
   * @returns {Promise}
   */
  louDongListGet: ({ldxxMc, page, pageSize, xzjdId}) => {
    let params = {ldxxMc, page, pageSize, xzjdId}
    for (let i in params) {
      if (params.hasOwnProperty(i)) {
        if (!params[i]) {
          delete params[i]
        }
      }
    }
    return post('login', '/tianwang/yewuzhongxin/loudong/list', params)
  },
  /**
   * 查看楼栋住户信息
   * @param ldxxZj
   * @returns {Promise}
   */
  louDongGet: ({ldxxZj}) => {
    let params = {ldxxZj}
    for (let i in params) {
      if (params.hasOwnProperty(i)) {
        if (!params[i]) {
          delete params[i]
        }
      }
    }
    return post('login', '/tianwang/yewuzhongxin/loudong/get', params)
  },
  /**
   * 住户成员列表
   * @param fangHao
   * @param ldxxZj
   * @returns {Promise}
   */
  zhuHuCYListGet: ({fangHao, ldxxZj}) => {
    let params = {fangHao, ldxxZj}
    for (let i in params) {
      if (params.hasOwnProperty(i)) {
        if (!params[i]) {
          delete params[i]
        }
      }
    }
    return post('login', '/tianwang/zhzxrhpt/loudong/zhuhu/cy/list', params)
  },
  /**
   * 楼栋住户列表
   * @param guanLianMdzj
   * @param ldxxZj
   * @param page
   * @param pageSize
   * @returns {Promise}
   */
  louDongZhuHuListGet: ({guanLianMdzj, ldxxZj, page, pageSize}) => {
    let params = {guanLianMdzj, ldxxZj, page, pageSize}
    for (let i in params) {
      if (params.hasOwnProperty(i)) {
        if (!params[i]) {
          delete params[i]
        }
      }
    }
    return post('login', '/tianwang/zhzxrhpt/loudong/zhuhu/list', params)
  },
  /**
   * 查询公民信息(qiuyanping)
   * @param gmxxZj
   * @returns {Promise}
   */
  gongminGet: ({gmxxZj}) => {
    let params = {
      gmxxZj: gmxxZj
    }
    return post('login', '/tianwang/shuju/gongmin/get', params)
  },
  /**
   * 获取所有组织机构列表(qiuyanping)
   * @param orgName
   * @param _query
   * @param _page
   * @param _pageSize
   * @returns {Promise}
   */
  orgAllListGet: ({orgName, _query, _page, _pageSize}) => {
    let params = {
      orgName: orgName
    }
    if (_query) {
      params['_query'] = _query
    }
    if (_page) {
      params['_page'] = _page
    }
    if (_pageSize) {
      params['_pageSize'] = _pageSize
    }
    return post('oauth', 'ehome.inner.org.all.list.get', params)
  },
  /**
   * 根据组织编号分页获取获取海康监控点信息（qiuyanping）
   * @param orgName
   * @param _query
   * @param _page
   * @param _pageSize
   * @returns {Promise}
   */
  findCameraInfoPageByTreeNode: () => {
    return post('login', '/tianwang/findCameraInfoPageByTreeNode', {})
  }
}
